package com.uaroadshow.finale.dao;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.uaroadshow.entity.trade.Product;
import com.uaroadshow.entity.trade.ProductStat;

/**
 *
 * @author Ark
 *
 */
@Dao("hibernate")
public interface ProductDao {

    /**
     * @return
     */
    @Query("FROM Product WHERE disabled = false")
    public List<Product> list();
    
    /**
     * @return
     */
    @Query("FROM ProductStat WHERE disabled = false")
    public List<ProductStat> listStat();
    
    /**
     * @param product
     * @return
     */
    @Query("FROM Product WHERE disabled = false AND parent = :parent")
    public List<Product> listChild(@Variable("parent") Product product);
    
    /**
     * @param product
     * @return
     */
    @Query("FROM ProductStat WHERE disabled = false AND product = :product")
    public ProductStat getStat(@Variable("product") Product product);
    
}
